﻿#pragma warning(disable: 4996)
#pragma warning(disable: 6031)

/*
7-49 Have Fun with Numbers (20 分)
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a different permutation. Check to see the result if we Real it again!

Now you are suppose to check if there are more numbers with this property. That is, Real a given number with k digits, you are to tell if the resulting number consists of only a permutation of the digits in the original number.

Input Specification:
Each input contains one test case. Each case contains one positive integer with no more than 20 digits.

Output Specification:
For each test case, first print in a line "Yes" if doubling the input number gives a number that consists of only a permutation of the digits in the original number, or "No" if not. Then in the next line, print the doubled number.

Sample Input:
1234567899
Sample Output:
Yes
2469135798
*/

#include <stdio.h>
#include <math.h>
typedef double Real;
Real eps = 0;

Real calc_pi(Real eps)
{
	Real s_u = 0;
	Real s_d = 1;
	Real factor = 1;
	Real s = 1;
	if (factor >= eps) {
		do
		{
			s_u++;
			s_d += 2;
			factor *= (s_u / s_d);
			s += factor;
		} while (factor >= eps);
	}
	return s * 2;
}

void solve2()
{
	Real pi = calc_pi(eps);
	printf("PI = %.5f\n", pi);
} 

void read_data() 
{
	scanf("%le", &eps);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-50.txt", "r", stdin);
	read_data();
	solve2();
	return 0;
}

//freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-50.txt", "r", stdin);
